package com.craterhill.java.ccp.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.craterhill.java.ccp.common.beans.StaffRole;
import com.craterhill.java.ccp.dao.impl.AbstractDao;
import com.craterhill.java.ccp.dao.utils.CCPResultSetExtractor;

public interface StaffRoleDao extends CCPDao<StaffRole> {
	public final String FIELD_LIST = " obj.role_id, obj.staff_id " + AbstractDao.MONITER_FIELDS;
	public final String FIND_ALL_STAFFROLE = "select " + FIELD_LIST + " from staff_role obj ";
	
	public final class StaffRoleExtractor extends CCPResultSetExtractor<StaffRole> {
		@Override
		protected StaffRole extractResultSetData(ResultSet resultSet) throws SQLException {
			StaffRole staffrole = new StaffRole();
			staffrole.setRoleId(resultSet.getInt(1));
			staffrole.setStaffId(resultSet.getInt(2));
			staffrole.setStatus(resultSet.getBoolean(3));
			staffrole.setCreatedBy(resultSet.getInt(4));
			staffrole.setModifiedBy(resultSet.getInt(5));
			staffrole.setCreatedDate(resultSet.getDate(6));
			staffrole.setModifiedDate(resultSet.getDate(7));
			return staffrole;
			
		}
	}

}
